//---------------------------------------------------------------------------

#ifndef MotionH
#define MotionH

////////////////////////////////////////////////////////////////////////////////////////////////////
// Defination for motion mode
////////////////////////////////////////////////////////////////////////////////////////////////////
#define NO_MOTION				 0
#define POS_STAND_NOHEAD 48
#define POS_STAND        49
// Continuous Moiton
#define STOP        	100
#define STEP        	101
#define SHIFT       	102
#define TURN        	103
#define TURNBALL    	104
#define WALK        	105
#define WALK_RAISEARM	106

// Fall down
//#define TORQUEOFF   230
//#define GETINGUP    231
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
typedef struct
{
	unsigned char Mode;
	unsigned char Mode_RX;
	unsigned char Mode_Past;
	unsigned char Doing; // Tell the computer which motion is doing
											 // 0 for done, others for doing the motion
	bool Replaceable; // if motion_mode > 110
										// which means the motion must be done finish and
										// can't replaced by following motion_mode_RX

	bool Continue_Eanble;
	unsigned char Continue_Set;

	float ContinueAngle;
	float ContinueDistance;
	float ContinueAngle_Past;
	float ContinueDistance_Past;
	float ContinueAngle_RX;
	float ContinueDistance_RX;

	int DoneX;
	int DoneY;
	int DoneAngle;

//	MotionStateStatus StateMode;

	unsigned char Queue[MOTION_QUEUE_SIZE];
} MotionStruct;
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

extern MotionStruct Motion;

void Motion_Init(void);
void SingleMotion(void);
void ContinuousMotion(void);
void Mtn_POSE_Standing(int speedL, int speedH, int steptime);
void Mtn_POSE_Standing_Nohead(int speedL, int speedH, int steptime);
AnsiString MotionMode2MotionName(unsigned char motion_mode);
//---------------------------------------------------------------------------

#endif
